local factorial = {}
function factorial.func(x)
if x == 1 then
return 1
else
return x * factorial.func(x - 1)
end
end
print("Please input a number:")
local n = tonumber(io.read())
if nil == n then
print("Error!")
return
elseif math.floor(n) ~= n then
print("Error!")
return
else
print(factorial.func(n))
end